package chapter18;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class LoginInfo implements Serializable{
	private String name;
	private transient String password;
	
	public LoginInfo(String _name,String _password)
	{
		name=_name;
		password=password;
	}

	/**
	 * @param args
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 * @throws ClassNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
		// TODO Auto-generated method stub
		File file=new File("LoginInfo");
		ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream(file));
		LoginInfo info=new LoginInfo("infear", "111");
		out.writeObject(info);
		ObjectInputStream in=new ObjectInputStream(new FileInputStream(file));
		info=(LoginInfo)in.readObject();
		System.out.println(info.name+":"+info.password);

	}

}
